# -*- coding:utf-8 -*-
# --author： jingfeng 
# time: 2019/4/14

import requests

from requests import Session

requests = requests.Session()
headers = {
    'Connection': 'keep-alive',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
    'Referer': 'https://www.lagou.com/',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    }

params = (
    ('labelWords', ''),
    ('fromSearch', 'true'),
    ('suginput', ''),
    )

response = requests.get('https://www.lagou.com/jobs/list_python',
                        headers=headers, params=params)

data = {
    'first': 'true',
    'pn': '1',
    'kd': 'python'
    }
# proxies = {
#     'https': 'https://61.8.78.130:8080'
# }
url = 'https://www.lagou.com/jobs/positionAjax.json?needAddtionalResult=false'
headers = {
    'Referer': 'https://www.lagou.com/jobs/list_python?labelWords=&fromSearch=true&suginput=',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36',
    'X-Anit-Forge-Code': '0',
    'X-Anit-Forge-Token': 'None',
    'X-Requested-With': 'XMLHttpRequest',
    }
response = requests.post(url, data=data, headers=headers)
print(response.json())
